<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="format-detection" content="telephone=no" />
    <meta name="format-detection" content="email=no" />
    <title>详情</title>
    <link rel="stylesheet" href="../../css/api.css">
    <link rel="stylesheet" href="../../css/vant.css">
    <link rel="stylesheet" href="../../css/main.css">
    <style>
        html,
        body {
            background-color: #fff;
            padding-bottom: .30rem;
        }

        .title {
            color: #333333;
            font-size: .20rem;
        }

        .app {
            padding: 0.05rem .24rem;
        }

        .time {
            /* padding: .18rem 0 0 0; */
            color: #666666;
            font-size: .14rem;
            padding-top: .18rem;
        }

        .creat-time {
            color: #999999;
            padding-right: .16rem;
        }
        .content img{
            max-width: 100%;
            height: auto;
        }
        .content{
            padding-top: .18rem;
        }
        .line{
            height: 0.005rem;
            background-color: #EAEAEA;
            width: 100%;
            margin-top: .18rem;
        }
    </style>
</head>

<body>
    <div class="app" v-cloak>
        <div class="title">{{detailData.title}}</div>
        <div class="line"></div>
        <div class="time">
            <span class="creat-time">{{handleTimeYMD2(detailData.createTime)}}</span>
            <span>{{detailData.viewsNum}}人看过</span>
        </div>
        <div class="line"></div>

        <div class="content" v-html="detailData.content">

        </div>
    </div>
    <script src="../../script/api.js"></script>
    <script src="../../script/flexible.js"></script>
    <script src="../../script/fastclick.js"></script>
    <script src="../../script/vue.min.js"></script>
    <script src="../../script/iconfont.js"></script>
    <script src="../../script/vant.min.js"></script>
    <script src="../../script/common.js"></script>
    <script src="../../script/restful.js"></script>
    <script src="../../script/businessCommon.js"></script>
    <script>
        apiready = function () {
            vm = new Vue({
                el: '.app',
                data: {
                    detailData: {},
                    id: null,
                },

                mounted: function () {
                    this.id = api.pageParam.id
                    this.getDetailData()
                    this.addScanRecord()
                },
                methods: {
                    // 添加浏览记录
                    addScanRecord() {
                        let vm = this
                        index.news("addNewsLook")({
                            id: vm.id
                        }, function (ret) {

                        })
                    },
                    // 获取文章详情
                    getDetailData() {
                        let vm = this
                        index.news("getNewsDetail")({
                            id: vm.id
                        }, function (ret) {
                            vm.detailData = ret.data
                        })
                    },
                },
            });

            api.addEventListener({
                name: 'showNewsShare'
            }, function (ret, err) {
                toReportOrShareDialog("NEWSDETAIL", vm.id, 2, vm.detailData.title)
            });
        }
    </script>
</body>

</html>